<template>
	<view class="">
		<view class="bg" value="当前时间" @click="getMon">
			这是数据：{{getTime}}{{time}}{{date}}
		</view>
	</view>

</template>

<script>
	

	export default {
		data() {
			return {
				time: '',
				date: '',
				getTime: ''
			}
		},

		methods: {
			getMon() {



				//得到时间格式2018-10-02
				const formatDate = date => {
					const year = date.getFullYear()
					const month = date.getMonth() + 1
					const day = date.getDate()
					return [year, month, day].map(formatNumber).join('-')

				}

				const formatNumber = n => {
					n = n.toString()
					return n[1] ? n : '0' + n
				}
			}
		}
	}
</script>

<style>
	.bg {
		margin-top: 70rpx;
		width: 600rpx;
		height: 60rpx;
		background-color: #55aa7f;
	}
</style>
